#!/bin/env python
# -*- coding: utf-8 -*-
'''
Created on Mar 21, 2011

@author: kivson
'''

import mwclient

def main():

    site = mwclient.Site('pt.wikiquote.org')
    total = 0

    for page in site.allpages():
        if page.redirect:
            continue
        out = file("/home/kivson/wikiquote/" + page.name, 'w')
        paginaText = page.edit()
        #paginaText =paginaText.decode('utf8')
        out.write(paginaText)
        out.close()

        total = total +1
        print total


if __name__ == '__main__':
    main()